package com.jeesite.modules.storage.api;

import com.jeesite.modules.storage.common.ServerResponse;
import com.jeesite.modules.storage.util.GtPushUtil;
import com.jeesite.modules.storage.util.JPushUtil;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author: starmile
 * @Description:
 * @Create: 2020-02-14 11:11
 **/
@RestController(value = "apigtpush")
@RequestMapping(value = "/api/gtpush")
public class GtPushController extends APIController {
    /**
     * 快速推送全平台消息
     * @param title 标题
     * @param massage 消息内容
     * @param url 链接
     * @param transmissionType 透传消息接受方式设置，1：立即启动APP，2：客户端收到消息后需要自行处理
     * @param transmissionContent 透传消息内容
     * @return 结果
     */
//    @RequestMapping(method = RequestMethod.POST,value = "pushAll")
    @RequestMapping(method = RequestMethod.GET,value = "pushAll")
    @ResponseBody
<<<<<<< HEAD
    public ServerResponse<Boolean> pushAll(String title, String massage){
        Boolean result = GtPushUtil.push();
        return ServerResponse.createBySuccess(200, result?"推送成功":"推送失败", result);
=======
    public ServerResponse<Boolean> pushAll(String title, String massage, String url, Integer transmissionType, String transmissionContent){
        Boolean result = GtPushUtil.push(title, massage, url, transmissionType, transmissionContent);
        return ServerResponse.createBySuccess(200, result?"推送成功.":"推送失败.", result);
>>>>>>> c88a136b4c055385cbe253daf39cca287214ccd6
    }

    /**
     * 推送消息
     * @param alias 指定用户
     * @param title 标题
     * @param massage 信息
     * @param url 链接
     * @param transmissionType 透传消息接受方式设置，1：立即启动APP，2：客户端收到消息后需要自行处理
     * @param transmissionContent 透传消息内容
     * @return
     */
//    @RequestMapping(method = RequestMethod.POST,value = "push")
    @RequestMapping(method = RequestMethod.GET,value = "push")
    @ResponseBody
<<<<<<< HEAD
    public ServerResponse<Boolean> push(String clientId, String title, String massage){
        Boolean result = GtPushUtil.push(clientId, title, massage);
        return ServerResponse.createBySuccess(200, result?"推送成功":"推送失败", result);
=======
    public ServerResponse<Boolean> push(String alias, String title, String massage, String url, Integer transmissionType, String transmissionContent){
        Boolean result = GtPushUtil.push(alias, title, massage, url, transmissionType, transmissionContent);
        return ServerResponse.createBySuccess(200, result?"推送成功.":"推送失败.", result);
>>>>>>> c88a136b4c055385cbe253daf39cca287214ccd6
    }
}
